# 抓花生游戏

import random

list1 = [1, 2, 3, 4, 5]

number = int(input("请输入花生的个数："))

while number > 0:
    number1 = int(input("小伙子来抓个吧！"))
    if number1 > 5:
        print("喝酒吧！少年")
        break
    if number1 > number:
        print("请重新抓取")
        number1 = int(input("小伙子来抓个吧！"))
    if number - number1 <= 0:
        print("喝酒吧！少年")
        break
    number = number - number1
    if number < 5:
        list2 = list(range(1,number + 1))
        number2 = random.choice(list2)

    else:
        number2 = random.choice(list1)

    print("系统抓取的个数为：",
    number2)
    if number - number2 <= 0:
        print("少年你赢了")
        break
    number = number - number2